Skip to content

feat: implement WithMetadataKey filter across all backends#23

Merged
rbaliyan merged 1 commit into
mainfrom
feat/metadata-filter-all-backends
Apr 24, 2026
Merged

feat: implement WithMetadataKey filter across all backends#23
rbaliyan merged 1 commit into
mainfrom
feat/metadata-filter-all-backends

Conversation

@rbaliyan
Copy link
Copy Markdown
Owner

Summary

  • SQLite: uses json_each(metadata) to match key-value pairs, consistent with the existing tag filter pattern
  • MongoDB: appends metadata.<key> = value dot-notation filters to the BSON query
  • ClickHouse: uses JSONExtractString(metadata, key) = value
  • Proto: adds map<string,string> metadata_filters (field 7) to ReadOptions; regenerated api/ledger/v1/ledger.pb.go
  • ledgerpb: ReadOptions struct gains MetadataFilters map[string]string; readOptionsFromProto and commonOpts() wired up
  • storetest: new WithMetadataKeyFilter conformance test covering single-key, AND of two keys, and no-match cases
  • store.go: godoc updated — removes the "only PostgreSQL" caveat

PostgreSQL already supported this filter via metadata @> $N::jsonb (added in a prior PR).

Test plan

  • go test -race ./... — all packages pass
  • golangci-lint run ./... — 0 issues
  • Integration tests against Postgres, MongoDB, ClickHouse

SQLite uses json_each to match key-value pairs in the metadata column.
MongoDB appends dot-notation filters on the metadata subdocument.
ClickHouse uses JSONExtractString for key lookup.

The proto ReadOptions message gains a metadata_filters map<string,string>
field (field 7). The ledgerpb adapter translates map entries to
WithMetadataKey calls so the gRPC/HTTP gateway surfaces the same filter.

Conformance test added to storetest covering single-key filter, AND of
two keys, and non-matching value.
@rbaliyan rbaliyan merged commit 1061a0d into main Apr 24, 2026
10 checks passed
@rbaliyan rbaliyan deleted the feat/metadata-filter-all-backends branch April 24, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant